<!--ADDBOX-->
<div class="row-fluid sortable">
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2><i class="icon-plus"></i> New Category</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-down"></i></a>
				<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
			</div>
		</div>
		<div id="box-add" class="box-content" style="display: none">
			<form class="form-horizontal" method="POST" action="<?php echo $this->Html->url(array('controller' => 'categories', 'action' => 'add', 'api' => true));?>">
			  <fieldset>
				<legend>New Category</legend>
			  	<div class="control-group">
				  <label class="control-label" for="CategoryName">Name</label>
				  <div class="controls">
				  	<input class="input-xlarge" id="CategoryName" type="text" value="" name="data[Category][name]" required="required">
				  </div>
			  	</div>
			  	<div class="control-group">
				  <label class="control-label" for="CategoryParent">Parent</label>
				  <div class="controls">
				  	<select id="CategoryParent" name="data[Category][parent_id]" required="required" data-rel="chosen">
				  		<option value="0">Root</option>
						<?php foreach($parents as $parent):?>
				  			<option value="<?php echo $parent['Category']['id'];?>"><?php echo $parent['Category']['name'];?></option>
				  		<?php endforeach;?>
				  	</select>
				  </div>
			  	</div>			  	     
				<div class="form-actions">
				  <button type="submit" class="btn btn-primary">Save</button>
				  <button id="reset" type="reset" class="btn">Reset</button>
				</div>
			  </fieldset>
			</form>
		</div>
	</div>
</div>
<!--TABLE-->
<div class="row-fluid sortable">		
	<div class="box span12">
		<div class="box-header well" data-original-title>
			<h2><i class="icon-book"></i> Category Management</h2>
			<div class="box-icon">
				<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
				<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
			</div>
		</div>
		<div id="box-index" class="box-content" alt="<?php echo $this->Html->url(array('controller' => 'categories', 'action' => 'index', 'ajax' => true));?>">	
		</div>
	</div>
</div>
<!-- SCRIPT -->
<script type="text/javascript">
$(document).ready(function () {
	IndexBox.display();
	AddBox.listen();	
});       	
</script>